package com.itbaizhan.controller;

import com.itbaizhan.pojo.Item;
import com.itbaizhan.result.BaseResult;
import com.itbaizhan.service.HotProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author spf
 * @date 2024/3/4
 * @time 11:08
 */

/**
 * 热销商品控制器API
 */
@RestController
@RequestMapping("/hotProduct")
public class HotProductController {

    @Autowired
    private HotProductService hotProductService;

    /**
     * 查询热销商品
     * @param city 城市
     * @return 执行结果
     */
    @GetMapping("/findHotProductPage")
    public BaseResult<List<Item>> findHotProductPage(@RequestParam("city") String city){
        List<Item> hotProducts = hotProductService.getHotProducts(city);
        return BaseResult.ok(hotProducts);
    }

}
